using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_testMap : EntityTypeConfiguration<so_test>
    {
        public so_testMap()
        {
            // Primary Key
            this.HasKey(t => new { t.View, t.Link, t.SourceField, t.DestField, t.LinkType, t.Symbol });

            // Properties
            this.Property(t => t.View)
                .IsRequired()
                .HasMaxLength(34);

            this.Property(t => t.Link)
                .IsRequired()
                .HasMaxLength(22);

            this.Property(t => t.SourceField)
                .IsRequired()
                .HasMaxLength(26);

            this.Property(t => t.DestField)
                .IsRequired()
                .HasMaxLength(33);

            this.Property(t => t.LinkType)
                .IsRequired()
                .HasMaxLength(18);

            this.Property(t => t.Symbol)
                .IsRequired()
                .HasMaxLength(15);

            // Table & Column Mappings
            this.ToTable("so_test");
            this.Property(t => t.View).HasColumnName("View");
            this.Property(t => t.Link).HasColumnName("Link");
            this.Property(t => t.SourceField).HasColumnName("SourceField");
            this.Property(t => t.DestField).HasColumnName("DestField");
            this.Property(t => t.LinkType).HasColumnName("LinkType");
            this.Property(t => t.Symbol).HasColumnName("Symbol");
        }
    }
}
